/**
 * 授权 API
 */
import {
	http
} from '../request/main.js';


/**
 * 获取礼品列表
 * 
 * @returns {Promise}
 */
export function getList(group, sort, page, page_size) {
	return http.post('/gift/getList', {
		group,
		sort,
		page,
		page_size
	});
}

/**
 * 获取礼品详情
 * 
 * @returns {Promise}
 */
export function getDetail(id) {
	return http.post('/gift/getDetail', {
		id
	});
}


/**
 * 获取兑换预览
 * 
 * @returns {Promise}
 */
export function getPreview(gift_id, gift_spec_id) {
	return http.post('/gift/getPreview', {
		gift_id,
		gift_spec_id
	});
}

/**
 * 进行兑换
 * 
 * @returns {Promise}
 */
export function exchange(formData) {
	return http.post('/gift/exchange', formData);
}


/**
 * 取消订单
 * 
 * @returns {Promise}
 */
export function orderCancel(order_id) {
	return http.post('/gift/orderCancel', {
		order_id
	});
}



/**
 * 获取兑换列表
 * 
 * @returns {Promise}
 */
export function getOrderList(group, page, page_size) {
	return http.post('/gift/getOrderList', {
		group,
		page,
		page_size
	});
}

/**
 * 获取兑换详情
 * 
 * @returns {Promise}
 */
export function getOrderDetail(id) {
	return http.post('/gift/getOrderDetail', {
		id
	});
}

/**
 * 获取物流动态
 * 
 * @returns {Promise}
 */
export function getExpressFeed(id) {
	return http.post('/gift/getExpressFeed', {
		id
	});
}
